<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Node;
use App\Models\Fang;

class IndexController extends Controller
{
    //
    public function index()
    {
        //读取菜单
        $auth = session('admin.auth');//权限
        $menuData = (new Node)->treeData($auth);
        return view('admin.index.index',compact('menuData'));
    }
    public function welcome()
    {
        $data = (new Fang())->fangStatusCount();
        return view('admin.index.welcome',$data);
    }

    //退出
    public function logout()
    {
        auth()->logout();
        //跳转代替是 闪存 session
        return redirect(route('admin.login'))->with('success','请重新登陆');
    }
}
